<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get minimal number of days the first week in a year or month can have</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getmaximum.html">IntlCalendar::getMaximum</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.getminimum.html">IntlCalendar::getMinimum</a></div>
 <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="intlcalendar.getminimaldaysinfirstweek" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::getMinimalDaysInFirstWeek</h1>
  <p class="verinfo">(PHP 5.5.0, PECL &gt;= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::getMinimalDaysInFirstWeek</span> &mdash; <span class="dc-title">Get minimal number of days the first week in a year or month can have</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.getminimaldaysinfirstweek-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>IntlCalendar::getMinimalDaysInFirstWeek</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>intlcal_get_minimal_days_in_first_week</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$cal</code></span>
   )</div>

  <p class="para rdfs-comment">
   Returns the smallest number of days the first week of a year or month must
   have in the new year or month.  For instance, in the Gregorian calendar, if
   this value is 1, then the first week of the year will necessarily include
   January 1st, while if this value is 7, then the week with January 1st will
   be the first week of the year only if the day of the week for January 1st
   matches the day of the week returned by
   <span class="function"><a href="intlcalendar.getfirstdayofweek.html" class="function">IntlCalendar::getFirstDayOfWeek()</a></span>; otherwise it will be
   the previous yearʼs last week.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.getminimaldaysinfirstweek-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">cal</code></em></dt>

    <dd>

     <p class="para">
      The IntlCalendar resource.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.getminimaldaysinfirstweek-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An <span class="type"><a href="language.types.integer.html" class="type int">int</a></span> representing a number of days 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.getminimaldaysinfirstweek-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2543">
   <p><strong>Example #1 <span class="function"><strong>IntlCalendar::getMinimalDaysInFirstWeek()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'date.timezone'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'UTC'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'intl.default_locale'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'en_US'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cal&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">IntlGregorianCalendar</span><span style="color: #007700">(</span><span style="color: #0000BB">2013</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0&nbsp;</span><span style="color: #FF8000">/*&nbsp;January&nbsp;*/</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'cccc'</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//&nbsp;Wednesday<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMinimalDaysInFirstWeek</span><span style="color: #007700">(),&nbsp;</span><span style="color: #FF8000">//&nbsp;1<br /></span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getFirstDayofWeek</span><span style="color: #007700">());&nbsp;</span><span style="color: #FF8000">//&nbsp;1&nbsp;(Sunday)<br /><br />//&nbsp;Week&nbsp;1&nbsp;of&nbsp;2013<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"'Week&nbsp;'w'&nbsp;of&nbsp;'Y"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setMinimalDaysInFirstWeek</span><span style="color: #007700">(</span><span style="color: #0000BB">4</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Still&nbsp;Week&nbsp;1&nbsp;of&nbsp;2013&nbsp;(1st&nbsp;week&nbsp;has&nbsp;5&nbsp;days&nbsp;in&nbsp;the&nbsp;new&nbsp;year)<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"'Week&nbsp;'w'&nbsp;of&nbsp;'Y"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setMinimalDaysInFirstWeek</span><span style="color: #007700">(</span><span style="color: #0000BB">6</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Week&nbsp;53&nbsp;of&nbsp;2012<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"'Week&nbsp;'w'&nbsp;of&nbsp;'Y"</span><span style="color: #007700">));</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
string(9) &quot;Wednesday&quot;
int(1)
int(1)
string(14) &quot;Week 1 of 2013&quot;
string(14) &quot;Week 1 of 2013&quot;
string(15) &quot;Week 53 of 2012&quot;
</pre></div>
    </div>
   </div>
  </p>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getmaximum.html">IntlCalendar::getMaximum</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.getminimum.html">IntlCalendar::getMinimum</a></div>
 <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
